package UIFree.controls
{
	import UIFree.uif_component;
	
	import UIUtils.uif_util;
	
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;

	public class uif_arrowbutton extends uif_button {
		public static const STYLEFIELD_ARROW: String = 'arrow';
		public static var ARROWINSQUARE	: Boolean = false;
		private var _orientation: int;
		
		public function uif_arrowbutton(parent:uif_component, 
			ax:int=0, ay:int=0, awidth:int=0, aheight:int=0, a_orientation: int=1, styleClass: Object='') {
			_orientation = a_orientation;
			super(parent, ax, ay, awidth, aheight, styleClass);
		}
		
		override protected function paint(a_styleClass: String, a_method: String = 'draw_rect'): void {
			super.paint(a_styleClass, a_method);
			var _astyle: Object = app.styleByObj(style[STYLEFIELD_ARROW]);
			_astyle.orientation = _orientation;
			var inner: Rectangle = getInner();
			if (ARROWINSQUARE) {
				if (inner.width>inner.height) inner.inflate((inner.height - inner.width) / 2 * uif_util.RBTRI, 0);
				else inner.inflate(0, (inner.width - inner.height) / 2 * uif_util.RBTRI);
			}
			this.draw_arrow(inner.x, inner.y, inner.width, inner.height, _astyle);
		}
		
		public function get orientation(): int {
			return _orientation;
		}

		public function set orientation(a_set: int): void {
			_orientation = a_set;
			repaint();
		}
	}
}